﻿//
// *************************************************************************************
// WP-Framework
// 
// Developed by
// Lukas Kretschmar (lkretschmar.dev@bluewin.ch)
//
// Switzerland, Copyright (c) 2013 lkretschmar
// This content is released under the MIT License (http://opensource.org/licenses/MIT).
//     
// *************************************************************************************
//
//
			

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using KretschIT.WP_Fx.EasyMoq.Generator.Tests.Helpers.Objects;
using System.Linq;
using KretschIT.WP_Fx.EasyMoq.Generator.Configurations;

namespace KretschIT.WP_Fx.EasyMoq.Generator.Tests.Configurations
{
    [TestClass]
    public class EasyMoqGeneratorTest
    {
        private EasyMoqGeneratorImpl generator;

        [TestInitialize]
        public void Init()
        {
            this.generator = new EasyMoqGeneratorImpl();
        }

        [TestMethod]
        public void Test_Configure()
        {
            this.generator.SetConfig(c =>
                {
                    c.CreateMockFor<ITestObject>();
                });
            var config = new EasyMoqConfig();
            this.generator.LoadConfiguration(config);
            Assert.IsNotNull(config);
            Assert.AreEqual(1, config.MockTypes.Count());
        }

        [TestMethod]
        public void Test_Configure_ThrowsException()
        {
            this.generator.SetConfig(c =>
            {
                throw new NotSupportedException();
            });
            var config = new EasyMoqConfig();
            this.generator.LoadConfiguration(config);
            Assert.IsNotNull(config);
        }
    }
}
